#pragma once
#include "core.h"
#include <QImage>
#include <QMap>
#include <QVector>

enum WidgetStatus
{
	kNormal,
	kHover,
	kPressed,
	kDisabled
};

class S_CORE_EXPORT SImage
{
public:
	SImage(const QString& path);
	~SImage();

	void setDevicePixelRatio(float f);
	float devicePixelRatio() const;
	QSize size() const;
	QRect rect() const;
	QImage* img() const { return m_img; }

	operator QImage();
	float width() const ;
	float height() const ;

private:
	QImage* m_img = nullptr;
};
class S_CORE_EXPORT ImgMgr
{
public:
	static ImgMgr& instance();
	void clean();

	void registerImgs(QString module);
	SImage* image(QString imgId, WidgetStatus type = WidgetStatus::kNormal, float scale = -1);

private:
	ImgMgr() = default;

private:
	QMap<QString, QVector<SImage*> >	m_imgs;//load when used?
};
